package switchviz.network.netswitch;

import org.jdom.Element;

import switchviz.gui.component.IXMLFilter;

public class SwitchXMLFilter extends IXMLFilter
{
	public SwitchXMLFilter()
	{
		this.ignoreName(SwitchTree.SWITCHDESCRIPTION);
		this.ignoreName(SwitchTree.SWITCHNAME);
		this.ignoreName(SwitchTree.SWITCHADDRESS);
		this.ignoreName(SwitchTree.SWITCHCOMMUNITY);
		this.ignoreName(SwitchTree.SWITCHMAXRETRIES);
		this.ignoreName(SwitchTree.SWITCHPDUCAPACITY);
		this.ignoreName(SwitchTree.SWITCHPORT);
		this.ignoreName(SwitchTree.SWITCHTIMEOUT);
		this.ignoreName(SwitchTree.SWITCHIFPORT);
		this.ignoreName(SwitchTree.SWITCHPORTCOUNT);
		this.ignoreName(SwitchTree.SWITCHTYPE);
	}

	public String Extract(Element rawNode) 
	{
		if(SwitchTree.SWITCHNODE.equals(rawNode.getName()))
		{
			return rawNode.getChildText(SwitchTree.SWITCHNAME);
		}
		return rawNode.getName() + ":  " + rawNode.getTextNormalize();
	}

}
